﻿using Melee.Controller.Request;
using Melee.Controller.Storage;

namespace Melee.Controller.Handlers
{
    public class CheckLoginHandler : RequestHandler
    {
        public override void Handle(WebRequest webRequest)
        {
            if (webRequest.IsAuthenticated)
            {
                webRequest.Cookie.Update();
                base.NextHandler.Handle(webRequest);
            }
            else
            {
                webRequest.Storage.Add(HttpStorageKeys.NotLogin, string.Empty);
                webRequest.AsyncResult.SetCompleted();
            }
        }
    }
}
